Skip to content

feat(test): add "test open <test-id>" to jump from the terminal to the dashboard#226

Open
Andy00L wants to merge 3 commits into
TestSprite:mainfrom
Andy00L:feat/test-open
Open

feat(test): add "test open <test-id>" to jump from the terminal to the dashboard#226
Andy00L wants to merge 3 commits into
TestSprite:mainfrom
Andy00L:feat/test-open

Conversation

@Andy00L

@Andy00L Andy00L commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Reopens #182, which was closed by the July 9 release incident (see the
maintainer's comment there). Same branch, same commits (head bbc079f0).

What does this PR do?

Adds testsprite test open <test-id> — the CLI already computes the Portal
deep-link and prints it as text on several commands; this closes the last inch
(the gh browse / cypress open hop). The URL is ALWAYS printed to stdout
first (so headless use and piping compose), then the OS default browser is
spawned unless --no-browser. The opener uses an argv-array spawn (never a
shell string) so a URL can never be shell-injected, refuses non-http(s)
schemes before any process is spawned, and is detached/unref'd so the CLI
exits immediately. A missing opener (containers, SSH) downgrades to a stderr
hint, never a failure; an endpoint with no known portal mapping is a hard
error pointing at TESTSPRITE_PORTAL_URL.

Related issue

Fixes #121

Type of change

  • New feature (non-breaking change that adds functionality)

Checklist

  • PR targets the main branch.
  • Commits follow Conventional Commits.
  • npm run lint and npm run format:check pass.
  • npm run typecheck passes.
  • npm test passes and coverage stays at or above the 80% gate.
  • New behavior is covered by unit tests (mock-based; no network).
  • No secrets, API keys, internal endpoints, or personal data are included.

Notes for reviewers

Platform openers: open (darwin), rundll32 url.dll,FileProtocolHandler
(win32 — avoids cmd /c start, whose re-parsing mangles & in URLs),
xdg-open (elsewhere). The opener is injectable (runOpen's third param), so
tests never spawn a real process; src/lib/browser.ts is at 100% coverage.

Andy00L added 3 commits July 6, 2026 19:04
openInBrowser threw a plain Error for a non-http(s) URL, which fell through the top-level handler and exited 1. Route it through localValidationError so it is classified as VALIDATION_ERROR and maps to the documented exit code 5, matching every other bad-argument path. Test asserts the exit code, not the message string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Hackathon] Add "test open <id>" / "--web" to jump from the terminal to the dashboard

1 participant